﻿using System;
using System.Collections.Generic;

using System.Text;
using System.Threading;

namespace AuroraLightsFX
{
    public class Delay : IDisposable
    {
        // Fields
        private AutoResetEvent _wait = null;

        // Methods
        public Delay()
        {
            this._wait = new AutoResetEvent(false);
        }

        public void Dispose()
        {
            this._wait = null;
        }

        public void Sleep(int milliseconds)
        {
            this._wait.Reset();
            this._wait.WaitOne(milliseconds, false);
        }

        public void WakeUp()
        {
            this._wait.Set();
        }
    }


}
